<template>
  <div>
    <button @click="add">Add Item</button>
    <button @click="remove">Remove Item</button>
    <transition-group name="list" tag="ul">
      <li v-for="(item, index) in items" :key="index" class="list-item">
        {{ item }}
      </li>
    </transition-group>
  </div>
</template>
<script>
export default {
  data() {
    return {
      items: ['Item 1', 'Item 2', 'Item 3']
    };
  },
  methods: {
    add() {
      const newItem = `Item ${this.items.length + 1}`;
      this.items.push(newItem);
    },
    remove() {
      if (this.items.length > 0) {
        this.items.pop();
      }
    }
  }
}
</script>
<style scoped>
.list-enter-active,
.list-leave-active {
  transition: all 0.5s;
}

.list-enter,
.list-leave-to {
  opacity: 0;
  transform: translateY(30px);
}

.list-item {
  display: inline-block;
  margin-right: 10px;
}
</style>